package com.muse.designpatterns.flyweight;

public class FlyWeightTest {
    private static NucleicInfoClient client = new NucleicInfoClient();

    public static void main(String[] args) {
        PersonInfo bob = new PersonInfo("bob","北京市海淀区xx街道xx小区",2);
        PersonInfo muse = new PersonInfo("muse","北京市房山区xx街道xx小区",7);
        PersonInfo john = new PersonInfo("john","北京市丰台区xx街道xx小区",4);

        printPersonInfo(bob);
        printPersonInfo(muse);
        printPersonInfo(john);
    }

    public static void printPersonInfo(PersonInfo personInfo) {
        NucleicInfo nucleicInfo = client.getNucleicInfo(personInfo.getNucleicId());
        System.out.printf("姓名：%s，居住地址：%s，核算网点：%s%n",personInfo.getName(),personInfo.getAddress()
        ,nucleicInfo.getName());
    }
}
